package com.zhkj.txg.module.member.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.lib.utils.SpanUtil
import com.zhkj.txg.R
import com.zhkj.txg.module.member.entity.MemberOrderEntity
import com.zhkj.txg.utils.ImageUtils

class MemberOrderAdapter : BaseQuickAdapter<MemberOrderEntity, BaseViewHolder>(R.layout.item_member_order),
    LoadMoreModule {

    override fun convert(helper: BaseViewHolder, item: MemberOrderEntity) {
        helper.setText(R.id.tvOrderGoodsName, item.goodsName)
            .setText(R.id.tvOrderGoodsPrice, SpanUtil.setMoneySymbol(item.goodsPrice ?: "", false))
            .setText(R.id.tvOrderGoodsNumber, "x${item.goodsNum}")
            .setText(R.id.tvMemberOrderNum, "共${item.goodsNum}件,合计")
            .setText(R.id.tvMemberOrderPrice, SpanUtil.setMoneySymbol(item.orderAmount ?: "0.0", false))
            .setVisible(R.id.tvMemberOrderShipping, item.shippingStatus.isNullOrBlank() && item.shippingStatus == "1")
            .setVisible(R.id.tvMemberOrderReceive,item.orderStatus!=2 && item.shippingStatus == "1")
        ImageUtils.loadRoundCornerImage(context, helper.getView(R.id.ivOrderGoods), item.image ?: "")

    }
}